#ifndef MEASURE_SIZE_TRACKER_POLYGON_2_H_
#define MEASURE_SIZE_TRACKER_POLYGON_2_H_

#if defined(_MSC_VER)
#pragma once
#endif

#include "point_2.h"
#include "box_2.h"
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/vector.hpp>
#pragma warning(push)  
#pragma warning(disable:4244)
#include <boost/geometry/geometries/register/ring.hpp>
#pragma warning(pop)

class polygon_2 :
  public std::vector<point_2>
{
  friend class boost::serialization::access;

public:
  enum MouseHit
  {
    kHitNothing = kMouseHitNothing,

    kHitVertex  = 0,
    kHitEdge    = 1,
    kHitOn      = kMouseHitOn,

    kHitButt
  };

  enum KeyStroke
  {
    kStrokeNothing    = kKeyStrokeNothing,

    kStrokeLineUp     = 0,
    kStrokeLineDown   = 1,
    kStrokeLineLeft   = 2,
    kStrokeLineRight  = 3,

    kStrokePageUp     = 4,
    kStrokePageDown   = 5,
    kStrokePageLeft   = 6,
    kStrokePageRight  = 7,

    kStrokeButt
  };

public:
  polygon_2(void);
  ~polygon_2(void);

public:
  int num_points(void) const { return size(); }
  box_2 bounds(void) const;

public:
  bool within(const point_2& pt) const;
  bool intersects(const box_2& box) const;

private:
  template<class Archive>
  void serialize(Archive &ar, const unsigned int version)
  {
    using boost::serialization::make_nvp;
    ar & make_nvp("vertexes", boost::serialization::base_object<std::vector<point_2>>(*this));
  }
};

BOOST_GEOMETRY_REGISTER_RING(polygon_2)

#endif // MEASURE_SIZE_TRACKER_POLYGON_2_H_